This section is intended to introduce the reader to various aspects of art, which may be related to various aspects of the present invention that are described and/or claimed below. This discussion is believed to be helpful in providing the reader with background information to facilitate a better understanding of the various aspects of the present invention. Accordingly, it should be understood that these statements are to be read in this light, and not as admissions of prior art.
Two methods of rendering shadows at interactive rates are shadow maps and shadow volumes, both of which can be implemented partially or completely in graphics cards. A shadow map is a two dimensional array of values representing the distance from a light source to the first occluding geometry in the scene, projected onto a plane and sampled at regular intervals. By a suitable sequence of geometric transformations it may be compared to the depth from the eye to the first occluding geometry in the scene, which can be used to calculate if a given pixel in the scene is in shadow or not. However, sampling artifacts may arise in the shadow calculation because geometric transformations used to create the shadow map may not be perfectly aligned.
Shadow maps become inefficient when rendering multiple shadows. For example, to render a scene lighted by an arbitrary number L point lighting sources, twice as many rendering passes (i.e. 2L passes) are needed (L passes to render the shadow maps, and L passes feeding into an accumulation buffer to composite the illumination information from each light in turn). Hardware-accelerated shadow mapping also consumes at least one texture unit which is a scarce resource in current graphics cards.
A shadow volume may represent areas in shadow in a scene by polyhedra enclosing the volumes that are occluded from the light source. Shadow volumes are less subject to sampling artifacts, but are unwieldy for many scenes. Shadow volumes can be used to cast accurate hard shadows without aliasing artifacts, but there is some extra cost in preprocessing the geometry and if the scene is made up of many small objects, for example the leaves of a plant, performance can become limited by stencil-buffer fill rate. It may also be difficult to modify shadow volume techniques to deal with effects such as hair and fog. The present invention may address one or more of the above issues.